<?php
    include_once("connect.php");


    $tel = $_POST['tel'];
    $user = $_POST['user'];
    $pwd = $_POST['pwd'];
    $email = $_POST['email'];
    $dear = $_POST['dear'];
    $male = $_POST['male'];
    // // $tel = '11111111111';

    // $tel = 12312312311;
    // $user = 'weraa';
    // $pwd = '121212';
    // $email = '321@qq.com';
    // $dear = '王无级';
    // $male = '男';
    // $tel = '11111111111';
    

    if($tel){
        $sql = "select * from user_info where user_tel = '$tel'";
        $data = mysqli_query($conn, $sql);
        $arr = mysqli_fetch_array($data);
        $res = [];
        if($arr){
            $res['status'] = false;
            $res['msg'] = '账号已存在';
        }else{

            $sql_add = "insert into user_info (user_name, user_pwd, user_email, user_dear, user_tel, user_male) values ('$user', '$pwd', '$email', '$dear', '$tel', '$male')";
            $data = mysqli_query($conn, $sql_add);
            $res['status'] = true;
            $res['msg'] = '注册成功';
            // echo($data);
        }
    }else{
        echo('数据传输失败');
    }
    echo(json_encode($res));
?>